/**
 * @author:albert
 */

package com.bkbw.live.battle.business.ai;

import com.badlogic.gdx.ai.msg.Telegram;

import com.bkbw.live.battle.business.UnitObject;
import com.bkbw.live.battle.business.ai.Goal.Status;

public class GoalSelector<EntityType extends UnitObject> extends GoalComposite<EntityType>{

	public GoalSelector(EntityType entity) {
		super(entity);
	}
	
	protected Goal<EntityType> currentGoal;
	
	// ----------- to be override -----------
	@Override
	public void activate() {
		super.activate();
		currentGoal = subgoalList.getFirst();
		currentGoal.activate();
	}
	
	@Override
	public Status process() {
		Status currentStatus = null;
		if (currentGoal != null) {
			currentStatus = currentGoal.process();
		}
		if (null == currentStatus) {
			return Status.Failed;
		}
		return null;
	}
	
	@Override
	public void terminate() {
		
	}
	
	@Override
	public boolean handleMessage(Telegram msg) {
		return false;
	}

}
